package com.github.gin.sns.vo.response;

import com.github.gin.sns.util.XStreamUtil;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.util.ArrayList;
import java.util.List;

@XStreamAlias("xml")
public class ONewsMessage extends OBaseMessage{
	@XStreamAlias("ArticleCount")
	private Integer articleCount;

	@XStreamAlias("Articles")
	private List<Article> articles;

	@XStreamAlias("item")
	public static class Article {
		@XStreamAlias("Title")
		private String title;

		@XStreamAlias("Description")
		private String description;

		@XStreamAlias("PicUrl")
		private String picUrl;

		@XStreamAlias("Url")
		private String url;

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public String getPicUrl() {
			return picUrl;
		}

		public void setPicUrl(String picUrl) {
			this.picUrl = picUrl;
		}

		public String getUrl() {
			return url;
		}

		public void setUrl(String url) {
			this.url = url;
		}
	}

	public Integer getArticleCount() {
		return articleCount;
	}

	public void setArticleCount(Integer articleCount) {
		this.articleCount = articleCount;
	}

	public List<Article> getArticles() {
		return articles;
	}

	public void setArticles(List<Article> articles) {
		this.articles = articles;
	}


	public static void main(String[] args){
		ONewsMessage message = new ONewsMessage();
		message.setFromUserName("aa");
		message.setToUserName("bb");
		message.setMsgType("aagag");
		message.setArticleCount(1);
		List<Article> articles = new ArrayList<>();
		Article article = new Article();
		article.setUrl("wwww");
		article.setPicUrl("asfaw");
		articles.add(article);
		message.setArticles(articles);
		System.out.println(XStreamUtil.getInstance().toXML(message));
	}
}
